'''
异常捕获
'''

# 1.NameError:变量未定义
i = j

# 2.SyntaxError:语法错误
print())

# 3.IndexError: string index out of range
a = '123'
print(a[3])


try:

except (NameError, ValueError, AttributeError, SyntaxError, IndexError, ZeroDivisionError, TypeError)


try:
    a = open('name.txt')
    raise Exception
except Exception as e:
    print(' %s' %e)
finally:
    a.close()
